package com.wandian.cqcsk.adapter;

import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.FragmentManager;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: cl
 * @CreateDate: 2021/3/12 10:54
 * @UpdateRemark:
 */

public class OpenPagerAdapter extends PagerAdapter {
    private List<View> mList = new ArrayList<>();
    public List<String> mTitleList;

    public OpenPagerAdapter(List<View> mList) {
        super();
        this.mList = mList;
    }
    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ((ViewPager) container).addView(mList.get(position));
        return mList.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        ((ViewPager) container).removeView(mList.get(position));
    }
}